package com.bana.fvs.protocol;

import com.bana.sys.protocol.Protocol;
import com.bana.sys.utils.Convert;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class SetCamera extends Protocol{

    @Override
    public short getId()
    {
        return 0xB2;
    }

    public byte[] request(String ip,int smallLow,int smallHigh,int bigLow,int bigHigh) throws IOException {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(baos);
        dos.write(Convert.toBuffer(ip));
        dos.writeByte(smallLow);
        dos.writeByte(smallHigh);
        dos.writeByte(bigLow);
        dos.writeByte(bigHigh);
        byte[] buffer= baos.toByteArray();
        dos.close();
        baos.close();
        return fillHead(buffer);
    }
}
